#include "../status_task.h"
#include "../../driver/powder/box_motors.h"
#include "../../driver/powder/cargo_motor.h"
#include "../../driver/powder/move_motor.h"
#include "../../driver/powder/sensor.h"
#include "../../service/salve_conn.h"
#include "../../driver/analog.h"

namespace task {

constexpr uint16_t APP_VERSION = 0x01;

using namespace utils;
using namespace driver;
using namespace service;


void StatusTask::run() {

    for (;;) {
        uint16_t sw = sensor->status() |
            (moveMotor->is_alm() << 7) |
            (cargoMotor->is_alm() << 8);

        salveConn->status_notify(
            APP_VERSION,
            sw,
            analog->value()
        );

        osDelay(500);
    }
}

}
